//
// Program.h
// Application Driver.
//
// Author: Gabriel H. Barbuto (gbarbuto@dc.uba.ar)
//
#ifndef _PROGRAM_H_
#define _PROGRAM_H_

#include <chrono>
#include <cstddef>
#include <cstdint>
#include <string>
#include <vector>

#include "IterativeMethod.h"

class CommandLineParser;

class Program
{
public:
	Program(int argc, char **argv);

	int run();

	friend class CommandLineParser;

private:
	int parse_command_line();

	void output_results() const;

	IterativeMethod *get_method() const;

	int _argc;
	char **_argv;

	double _root;
	double _alpha;
	double _epsilon;
	std::size_t _iterations;
	std::size_t _iterations_performed;
	std::size_t _run_count;
	std::vector<double> _arguments;

	std::string _function_name;
	std::string _method_name;

	std::chrono::duration<std::chrono::system_clock::rep, std::chrono::system_clock::period> _elapsed_time;

	static const int ERROR;
	static const int SUCCESS;
	static const int USAGE_SHOWN;
	static const int ERROR_IN_COMMAND_LINE;
	static const int ERROR_UNHANDLED_EXCEPTION;
};

#endif
